export default {
	getSsq(data) {
		return http('/Luckydog/GetSsq','get',data)
	},
	goSsq(data) {
	  return http('/Luckydog/GoSsq','post',data);
	}
}

// uni.request
const apiUrl = 'https://galaha.top/api/'
function http(url, method, data) {
	url = apiUrl + url
	return new Promise((resolve, reject) => {
		uni.request({
			url,
			method,
			data,
			header: {
				'X-Requested-With': 'XMLHttpRequest',
				'Content-Type': 'application/json'
			},
			success(res) {
				// console.log(res.data)
				resolve(res.data)
				if (res.data.code != 10000) {
					uni.showToast({
						text: res.data.msg,
						icon: 'none',
						duration: 1500
					})
				}
			},
			fail(err) {
				console.log(err)
				uni.showToast({
					title: err.errMsg,
					icon: 'none',
					duration: 1500
				})
				reject(err)
			}
		})
	})
}
